<?php

use yii\helpers\Html;
use yii\grid\GridView;
use common\business\EhrHelper;
use yii\helpers\ArrayHelper;

/* @var $this yii\web\View */
/* @var $searchModel common\models\kingdee\HrSSocAreaSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = Yii::t('kingdee', 'Hr Ssoc Areas');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="hr-ssoc-area-index">

    <h1><?= Html::encode($this->title) ?></h1>
    <?php // echo $this->render('_search', ['model' => $searchModel]); ?>

    <p>
        <?= Html::a(Yii::t('app', 'Create Hr Ssoc Area'), ['create'], ['class' => 'btn btn-success']) ?>
    </p>
    <?php
    try {
        $gv = GridView::widget([
            'tableOptions' => ['class' => 'table table-condensed table-bordered table-striped table-hover'],
            'pager' => [
//            'class'          => GoPager::className(),
                'nextPageLabel'  => Yii::t('app', 'Next Page'),
                'prevPageLabel'  => Yii::t('app', 'Previous Page'),
                'firstPageLabel' => Yii::t('app', 'First Page'),
                'lastPageLabel'  => Yii::t('app', 'Last Page'),
                'options' => [
                    'class' => 'pagination pagination-sm m-t-none m-b-none',
                ],
            ],
            'dataProvider' => $dataProvider,
            'filterModel' => $searchModel,
            'columns' => [
                ['class' => 'yii\grid\ActionColumn'],
                [
                    'class' => 'yii\grid\SerialColumn',
                    'contentOptions' => ['class' => 'vertical-middle text-center', 'style' => 'width: 25px;'],
                ],
                [
//                    'label' => Yii::t('app', 'Name'),
                    'attribute' => 'FNAME_L2',
                    'headerOptions' => ['class' => 'vertical-middle text-center', 'style' => 'width: 150px;'],
                    'contentOptions' => ['class' => 'vertical-middle text-center', 'style' => 'width: 150px;'],
                ],
                [
//                    'label' => Yii::t('app', 'Alias Name'),
                    'attribute' => 'FNAME_L3',
                    'headerOptions' => ['class' => 'vertical-middle text-center', 'style' => 'width: 150px;'],
                    'contentOptions' => ['class' => 'vertical-middle text-center', 'style' => 'width: 150px;'],
                ],
                [
//                    'label' => Yii::t('app', 'Number'),
                    'attribute' => 'FNUMBER',
                    'headerOptions' => ['class' => 'vertical-middle text-center', 'style' => 'width: 150px;'],
                    'contentOptions' => ['class' => 'vertical-middle text-center', 'style' => 'width: 150px;'],
                ],
                [
//                    'label' => Yii::t('app', 'Index'),
                    'attribute' => 'FUPSOCAREAID',
                    'headerOptions' => ['class' => 'vertical-middle text-center', 'style' => 'width: 50px;'],
                    'contentOptions' => ['class' => 'vertical-middle text-center', 'style' => 'width: 50px;'],
                ],
                [
//                    'label' => Yii::t('app', 'Is Preset'),
                    'attribute' => 'FISENABLE',
                    'headerOptions' => ['class' => 'vertical-middle text-center', 'style' => 'width: 50px;'],
                    'contentOptions' => ['class' => 'vertical-middle text-center', 'style' => 'width: 50px;'],
                ],
                [
//                    'label' => Yii::t('app', 'Control Unit'),
                    'attribute' => 'FCONTROLUNITID',
                    'value' => function ($model) {
                        return EhrHelper::getControlUnitStrById($model['FCONTROLUNITID']);
                    },
                    'filter' => ArrayHelper::map(\common\models\kingdee\CtrlUnit::find()->all(), 'FID', 'FNAME_L2'),
                    'headerOptions' => ['class' => 'vertical-middle text-center', 'style' => 'width: 100px;'],
                    'contentOptions' => ['class' => 'vertical-middle text-center', 'style' => 'width: 100px;'],
                ],
                [
//                    'label' => Yii::t('app', 'Fid'),
                    'attribute' => 'FID',
                    'headerOptions' => ['class' => 'vertical-middle text-center', 'style' => 'width: 100px;'],
                    'contentOptions' => ['class' => 'vertical-middle text-center', 'style' => 'width: 100px;'],
                ],
//                'FID',
//                'FISENABLE',
//                'FUPSOCAREAID',
//                'FNAME_L1',
//                'FNAME_L2',
                // 'FNAME_L3',
                // 'FNUMBER',
                // 'FDESCRIPTION_L1',
                // 'FDESCRIPTION_L2',
                // 'FDESCRIPTION_L3',
                // 'FSIMPLENAME',
                // 'FCREATORID',
                // 'FCREATETIME',
                // 'FLASTUPDATEUSERID',
                // 'FLASTUPDATETIME',
                // 'FCONTROLUNITID',
            ],
        ]);
    } catch (Exception $e) {
    }
    ?>
    <?= $gv ?>
</div>
